//
//  FFRegion.m
//  Common
//
//  Created by IT.Bear on 16/5/19.
//  Copyright © 2016年 IT.Bear. All rights reserved.
//

#import "FFRegion.h"

@implementation FFRegion

+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"regionId" : @"id" ,
             @"regionChildren" : @"children"
             };
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    // value should be Class or Class name.
    return @{@"regionChildren" : [self class]};
}

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
        self.parentId = [aDecoder decodeObjectForKey:@"parentId"];
        self.regionId = [aDecoder decodeObjectForKey:@"regionId"];
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.leaf = [aDecoder decodeBoolForKey:@"leaf"];
        self.regionChildren = [aDecoder decodeObjectForKey:@"regionChildren"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:self.parentId forKey:@"parentId"];
    [aCoder encodeObject:self.regionId forKey:@"regionId"];
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeBool:self.leaf forKey:@"leaf"];
    [aCoder encodeObject:self.regionChildren forKey:@"regionChildren"];
}

@end
